core = get_core()
light_cursor=0


function move_lights()
	local l_im=core:get_input_manager()
	local l_lm=core:get_light_manager()
	--local sc_obj=get_core():get_renderable_objects_layers_manager():get_resource("solid"):get_resource("my_object")
	--los valores estan hardcoded porque habria que registrar los InputDefs en lua. O al menos eso creo
	local l_NumOfLights = l_lm:get_num_of_lights()
	if (l_NumOfLights>0) then
	
		if (l_im:is_up_down(0,0x2E)) then --si c se presiona
			light_cursor=light_cursor+1
			
			if light_cursor==l_NumOfLights then light_cursor=0 end
			--debug_lua(light_cursor)
		end

		local light_selected=l_lm:get_resource_by_id(light_cursor)
		
		local curr_pos=light_selected:get_position()
		local final_pos = Vect3f(curr_pos)
		--debug_lua(curr_pos)
		local speed=50 * core:get_elapsed_time()
		if (l_im:is_down(0,CInputManager.KEY_UP)) then 
			final_pos.x=curr_pos.x+speed
		end

		if (l_im:is_down(0,CInputManager.KEY_DOWN)) then 
			--debug_lua(curr_pos.x)
			final_pos.x= curr_pos.x-speed
			--debug_lua(final_pos.x)
		end
		--******************************************
		if (l_im:is_down(0,CInputManager.KEY_O)) then 
			final_pos.y=curr_pos.y+speed
		end
		if (l_im:is_down(0,CInputManager.KEY_L)) then 
			final_pos.y=curr_pos.y-speed
		end
		if (l_im:is_down(0,CInputManager.KEY_LEFT)) then
			final_pos.z=curr_pos.z+speed
		end
		if (l_im:is_down(0,CInputManager.KEY_RIGHT)) then
			final_pos.z=curr_pos.z-speed
		end
		
		--sc_obj:set_position(curr_pos)
		light_selected:set_position(final_pos)
	end
end


